package cn.kgc.controller;

import cn.kgc.commons.vo.Result;
import cn.kgc.dto.SearchParam;
import cn.kgc.dto.SearchResult;
import cn.kgc.service.EsSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>添加描述信息</p>
 *
 * @author 卢传琪
 */
@RestController
@RequestMapping("/pms")
@Slf4j

@Api(tags = "商品搜索控制器")
public class EsSearchController {
    @Resource
    private EsSearchService esSearchService;

    @PostMapping("/search")
    @ApiOperation(value = "查询商品信息",httpMethod = "POST",produces = "application/json;charset=UTF-8",
            response = Result.class)
    @CrossOrigin
    public SearchResult search(@RequestBody SearchParam searchParam){
        return esSearchService.search(searchParam);
    }
}
